#include "readthread.h"
#include <errno.h>
#include <string.h>
#include <stdio.h>
//#define DEBUG
ReadThread::ReadThread(int num) : QThread()
{
    ycapi = new Ycapi();
    ioNum=num;
    flag=1;
}

ReadThread::~ReadThread()
{
    delete ycapi;
}

void ReadThread::run()
{
     unsigned char level;
     unsigned char ioAll=0;
     unsigned char level1[8]={0};
    while(flag)
    {
           //printf("Start Read...\n");
           if(ycapi->GetIoBlockMode(&level,ioNum))
           {
                ioAll=ycapi->GetIO(&level,ioNum);
           }
           printf("ioAll:%d,level:%d\n",ioAll,level);
           emit ReceivedData(&ioAll,ioNum);
    }
   // exec();
}
